﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
    CodeBehind="Information.aspx.cs" Inherits="DoAnWeb.Information" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register assembly="CKEditor.NET" namespace="CKEditor.NET" tagprefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Thông tin cá nhân</title>
    <style type="text/css">
        .style2
        {
            width: 980px;
            background: #fff;
        }
        .style3
        {
            height: 25px;
        }
        .style4
        {
            height: 24px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table cellpadding="2" cellspacing="0" class="style2">
        <tr>
            <td width="280">
                &nbsp;
            </td>
            <td style="text-align: left">
                <asp:Label ID="lbTieuDe" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: left" valign="top">
                <table cellpadding="2" class="style1">
                    <tr>
                        <td width="50" class="style4">
                            <asp:Image ID="Image1" runat="server" Height="36px" />
                        </td>
                        <td class="style4">
                            <asp:LinkButton ID="lbtnThongTinTaiKhoan" runat="server" OnClick="lbtnThongTinTaiKhoan_Click">Thông tin tài khoản</asp:LinkButton>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Image ID="Image2" runat="server" Height="36px" />
                        </td>
                        <td>
                            <asp:LinkButton ID="lbtnThayDoiMatKhau" runat="server" OnClick="lbtnThayDoiMatKhau_Click">Thay đổi mật khẩu</asp:LinkButton>
                        </td>
                    </tr>
                    <asp:Panel ID="pnMember" runat="server">
                        <tr>
                            <td>
                                <asp:Image ID="Image3" runat="server" Height="36px" />
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtnCacDealDaMua" runat="server" OnClick="lbtnCacDealDaMua_Click">Các deal đã mua</asp:LinkButton>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Image ID="Image4" runat="server" Height="36px" />
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtnLichSuaMuaHang" runat="server" OnClick="lbtnLichSuaMuaHang_Click"
                                    PostBackUrl="~/History.aspx">Lịch sử mua hàng</asp:LinkButton>
                            </td>
                        </tr>
                    </asp:Panel>
                    <asp:Panel ID="pnDoanhNghiep" runat="server">
                        <tr>
                            <td class="style3">
                                <asp:Image ID="Image5" runat="server" Height="36px" />
                            </td>
                            <td class="style3">
                                <asp:LinkButton ID="lbtnDanhSachDatGiao" runat="server" OnClick="lbtnDanhSachDatGiao_Click">Danh sách đặt giao</asp:LinkButton>
                            </td>
                        </tr>
                    </asp:Panel>
                    <asp:Panel ID="pnAdmin" runat="server">
                        <tr>
                            <td>
                                <asp:Image ID="Image6" runat="server" Height="36px" />
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtnQuanLyKhuyenMai" runat="server" OnClick="lbtnQuanLyKhuyenMai_Click" PostBackUrl="~/Product.aspx">Quản lý khuyến mại</asp:LinkButton>
                            </td>
                        </tr>
                    </asp:Panel>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </td>
            <td valign="top">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Panel ID="pnThongTinTaiKhoan" runat="server">
                            <table cellpadding="3" cellspacing="0" class="style1">
                                <tr>
                                    <td align="left" valign="bottom" width="150">
                                        Hình ảnh đại diện :
                                    </td>
                                    <td align="left">
                                        <asp:Image ID="imgHinhDaiDien" runat="server" ToolTip="Hình đại diện" Width="100px" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align: left">
                                        Tên tài khoản :
                                    </td>
                                    <td align="left">
                                        <asp:Label ID="lbTenTaiKhoan" runat="server"></asp:Label>
                                    </td>
                                </tr>
                                <asp:Panel ID="pnHoTenMember" runat="server">
                                    <tr>
                                        <td style="text-align: left">
                                            Họ tên :
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtHoTen" runat="server" Width="200px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvHoTen" runat="server" ControlToValidate="txtHoTen"
                                                Display="Dynamic" ErrorMessage="Họ tên không hợp lệ." ForeColor="Red" SetFocusOnError="True"
                                                ValidationGroup="ThongTinTaiKhoan">(*)</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                </asp:Panel>
                                <asp:Panel ID="pnTenDoanhNghiep" runat="server">
                                    <tr>
                                        <td style="text-align: left">
                                            Tên doanh nghiệp :
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtTenDoanhNghiep" runat="server" Width="200px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvTenDoanhNghiep" runat="server" ControlToValidate="txtTenDoanhNghiep"
                                                Display="Dynamic" ErrorMessage="Tên doanh nghiệp không hợp lệ." ForeColor="Red"
                                                SetFocusOnError="True" ValidationGroup="ThongTinTaiKhoan">(*)</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                </asp:Panel>
                                <tr>
                                    <td style="text-align: left">
                                        Ngày sinh :
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtNgaySinh" runat="server" ReadOnly="True" Width="100px"></asp:TextBox>
                                        <asp:ImageButton ID="imgCalendar" runat="server" Height="18px" ImageUrl="/images/Calendar_scheduleHS.png"
                                            Width="17px" />
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align: left">
                                        Giới tính :
                                    </td>
                                    <td align="left">
                                        <asp:RadioButton ID="rdNam" runat="server" Checked="True" Text="Nam" 
                                            GroupName="GioiTinh" />
                                        &nbsp;<asp:RadioButton ID="rdNu" runat="server" Text="Nữ" 
                                            GroupName="GioiTinh" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align: left">
                                        Địa chỉ :
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtDiaChi" runat="server" Width="400px"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvDiaChi" runat="server" ControlToValidate="txtDiaChi"
                                            Display="Dynamic" ErrorMessage="Chưa nhập  địa chỉ." ForeColor="Red" SetFocusOnError="True"
                                            ValidationGroup="ThongTinTaiKhoan">(*)</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        Điện thoại :
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtDienThoai" runat="server" MaxLength="12" Width="200px"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvDienThoai" runat="server" ControlToValidate="txtDienThoai"
                                            Display="Dynamic" ErrorMessage="Chưa nhập số điện thoại." ForeColor="Red" SetFocusOnError="True"
                                            ValidationGroup="ThongTinTaiKhoan">(*)</asp:RequiredFieldValidator>
                                        <asp:RegularExpressionValidator ID="rvDienThoai" runat="server" ControlToValidate="txtDienThoai"
                                            Display="Dynamic" ErrorMessage="Số điện thoại không hợp lệ." ForeColor="Red"
                                            SetFocusOnError="True" ValidationExpression="^[0-9]+$" ValidationGroup="ThongTinTaiKhoan">(*)</asp:RegularExpressionValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        Email :
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtEmail" runat="server" Width="200px"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ControlToValidate="txtEmail"
                                            Display="Dynamic" ErrorMessage="Chưa nhập Email." ForeColor="Red" SetFocusOnError="True"
                                            ValidationGroup="ThongTinTaiKhoan">(*)</asp:RequiredFieldValidator>
                                        <asp:RegularExpressionValidator ID="rvEmail" runat="server" ControlToValidate="txtEmail"
                                            Display="Dynamic" ErrorMessage="Email không hợp lệ." ForeColor="Red" SetFocusOnError="True"
                                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="ThongTinTaiKhoan">(*)</asp:RegularExpressionValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        Ngày đăng ký :
                                    </td>
                                    <td align="left">
                                        <asp:Label ID="lbNgayDangKy" runat="server"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        Loại tài khoản :
                                    </td>
                                    <td align="left">
                                        <asp:Label ID="lbLoaiTaiKhoan" runat="server"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        &nbsp;
                                    </td>
                                    <td align="left">
                                        <asp:Button ID="btnLuuThongTinTaiKhoan" runat="server" Height="30px" OnClick="btnLuuThongTinTaiKhoan_Click"
                                            Text="Lưu" ValidationGroup="ThongTinTaiKhoan" Width="90px" />
                                        &nbsp;<asp:Label ID="lbThongTinTaiKhoan" runat="server" ForeColor="#0066FF" Text="Thay đổi thông tin thành công."
                                            Visible="False"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" Style="text-align: left;
                                margin-left: 0px;" ValidationGroup="ThongTinTaiKhoan" />
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:Panel ID="pnThayDoiMatKhau" runat="server">
                            <table cellpadding="3" cellspacing="0" class="style1">
                                <tr>
                                    <td align="left" valign="middle" width="190">
                                        Mật khẩu hiện tại :
                                    </td>
                                    <td align="left" valign="middle">
                                        <asp:TextBox ID="txtMatKhauHienTai" runat="server" Width="200px" MaxLength="18" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvMatKhauHienTai" runat="server" ControlToValidate="txtMatKhauHienTai"
                                            ErrorMessage="Chưa nhập mật khẩu hiện tại." ForeColor="Red" SetFocusOnError="True"
                                            ValidationGroup="ThayDoiMatKhau" Display="Dynamic">(*)</asp:RequiredFieldValidator>
                                        &nbsp;<asp:Label ID="lbMatKhauHienTai" runat="server" ForeColor="Red" Text="Sai mật khẩu."
                                            Visible="False"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" valign="middle">
                                        Mật khẩu mới :
                                    </td>
                                    <td align="left" valign="middle">
                                        <asp:TextBox ID="txtMatKhauMoi" runat="server" Width="200px" MaxLength="18" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvMatKhauMoi" runat="server" ControlToValidate="txtMatKhauMoi"
                                            ErrorMessage="Chưa nhập mật khẩu mới." ForeColor="Red" SetFocusOnError="True"
                                            ValidationGroup="ThayDoiMatKhau" Display="Dynamic">(*)</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" valign="middle">
                                        Nhập lại mật khẩu mới :
                                    </td>
                                    <td align="left" valign="middle">
                                        <asp:TextBox ID="txtNhapLaiMatKhauMoi" runat="server" Width="200px" MaxLength="18"
                                            TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvNhapLaiMatKhauMoi" runat="server" ControlToValidate="txtNhapLaiMatKhauMoi"
                                            ErrorMessage="Chưa nhập lại mật khẩu." ForeColor="Red" SetFocusOnError="True"
                                            ValidationGroup="ThayDoiMatKhau" Display="Dynamic">(*)</asp:RequiredFieldValidator>
                                        <asp:CompareValidator ID="cvNhapLaiMatKhauMoi" runat="server" ControlToCompare="txtMatKhauMoi"
                                            ControlToValidate="txtNhapLaiMatKhauMoi" Display="Dynamic" ErrorMessage="Nhập lại không đúng."
                                            ForeColor="Red" ValidationGroup="ThayDoiMatKhau">(*)</asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" valign="middle">
                                        &nbsp;
                                    </td>
                                    <td align="left" valign="middle">
                                        <asp:Button ID="btnLuuThayDoimatKhau" runat="server" Height="30px" Text="Lưu" Width="90px"
                                            OnClick="btnLuuThayDoimatKhau_Click" ValidationGroup="ThayDoiMatKhau" />
                                        &nbsp;<asp:Label ID="lbThayDoiMatKhauThanhCong" runat="server" ForeColor="#0066FF"
                                            Text="Thay đổi mật khẩu thành công." Visible="False"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                            <asp:ValidationSummary ID="ValidationSummary2" runat="server" ForeColor="Red" Style="text-align: left"
                                ValidationGroup="ThayDoiMatKhau" />
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:Panel ID="pnCacDealDaMua" runat="server">
                    <asp:DataList ID="dlCacDealDaMua" runat="server" CellPadding="5" CellSpacing="15"
                        RepeatColumns="3" RepeatDirection="Horizontal" Style="margin-bottom: 1px">
                        <ItemStyle BorderStyle="None" />
                        <ItemTemplate>
                            <asp:Panel ID="Panel1" runat="server" CssClass="SanPham">
                                <asp:HyperLink ID="HyperLink2" runat="server" CssClass="TieuDe" NavigateUrl='<%# "ProductDetails.aspx?proID=" + Eval("MaTinKhuyenMai") %>'
                                    Text='<%# Eval("TieuDe") %>'></asp:HyperLink>
                                <br />
                                <br />
                                <br />
                                <div class="gallery">
                                    <asp:HyperLink ID="HyperLink3" runat="server" ImageUrl='<%# "~/images/Cat/Thumb/"+Eval("HinhAnh") %>'
                                        NavigateUrl='<%# "~/images/Cat/"+Eval("HinhAnh") %>'>HyperLink</asp:HyperLink>
                                </div>
                                <br />
                                <table cellpadding="0" cellspacing="0" class="style1">
                                    <tr>
                                        <td style="border-right-style: solid; border-right-width: 2px; border-right-color: #009933;"
                                            valign="top" class="ThongTinGia">
                                            Giá gốc:&nbsp;<asp:Label ID="Label4" runat="server" Font-Strikeout="True" ForeColor="Red"
                                                Text='<%# string.Format("{0:#,#.##}",Eval("GiaGoc"))+"vnđ" %>'></asp:Label>
                                            &nbsp;<asp:Label ID="Label7" runat="server" Font-Bold="True" Font-Size="Large" ForeColor="#0066FF"
                                                Text='<%# "-"+Eval("PhanTramKhuyenMai")+"%" %>'></asp:Label>
                                            <br />
                                            Giá bán:
                                            <asp:Label ID="Label5" runat="server" ForeColor="Red" Text='<%# string.Format("{0:#,#.##}",Eval("GiaBan"))+"vnđ" %>'></asp:Label>
                                            <br />
                                            Tình trạng:
                                            <asp:Label ID="Label10" runat="server" ForeColor="#0066FF" Text="Còn hàng" Visible='<%# TinhTrang(Convert.ToInt32(Eval("MaTinKhuyenMai").ToString())) %>'></asp:Label>
                                            <asp:Label ID="Label11" runat="server" ForeColor="Red" Text="Hết hàng" Visible='<%# !TinhTrang(Convert.ToInt32(Eval("MaTinKhuyenMai").ToString())) %>'></asp:Label>
                                            <br />
                                        </td>
                                        <td valign="top" width="100">
                                            <table cellpadding="0" cellspacing="0" class="style1">
                                                <tr>
                                                    <td class="SoLuotThamGia">
                                                        <br />
                                                        <asp:Label ID="Label13" runat="server" Text='<%# SoLuotThamGia(Convert.ToInt32(Eval("MaTinKhuyenMai").ToString())) %>'></asp:Label>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="LuotThamGiaTieuDe">
                                                        <asp:Label ID="Label12" runat="server" Text='Lượt tham gia' Font-Bold="False"></asp:Label>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </ItemTemplate>
                    </asp:DataList>
                    <asp:Label ID="lbThongBao" runat="server" Font-Bold="True" ForeColor="#FF3300" Text="Bạn  vẫn chưa từng mua sản phẩm nào."
                        Visible="False"></asp:Label>
                </asp:Panel>
                <asp:UpdatePanel ID="upnDanhSachDatGiao" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="gvDanhSachDatHang" runat="server" AutoGenerateColumns="False" BackColor="White"
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Font-Size="11pt"
                            Height="169px" OnRowCommand="gvDanhSachDatHang_RowCommand" OnSelectedIndexChanged="gvDanhSachDatHang_SelectedIndexChanged">
                            <Columns>
                                <asp:TemplateField HeaderText="Mã đặt">
                                    <ItemTemplate>
                                        <asp:Label ID="Label12" runat="server" Text='<%# Eval("MaCTDonHang") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("MaCTDonHang") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="TieuDe" HeaderText="Tiều đề" />
                                <asp:BoundField DataField="HoTen" HeaderText="Họ tên đặt" />
                                <asp:BoundField DataField="GiaBan" HeaderText="Giá bán" />
                                <asp:BoundField DataField="SoLuong" HeaderText="Số lượng" />
                                <asp:BoundField DataField="DiaChi" HeaderText="Địa chỉ" />
                                <asp:BoundField DataField="NgayDat" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Ngày đặt" />
                                <asp:TemplateField HeaderText="Trạng thái">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("DaGiao") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DaGiao") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                <asp:ButtonField CommandName="btnCapNhat" HeaderText="Cập nhật" Text="Chuyển" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" />
                            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle ForeColor="#000066" />
                            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                            <SortedAscendingCellStyle BackColor="#F1F1F1" />
                            <SortedAscendingHeaderStyle BackColor="#007DBB" />
                            <SortedDescendingCellStyle BackColor="#CAC9C9" />
                            <SortedDescendingHeaderStyle BackColor="#00547E" />
                        </asp:GridView>
                        <br />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
    <div _designerregion="0">
    </div>
</asp:Content>
